<?php
class Char{
	// ( ) < > [ ] { }
	var $brackets = array(40, 41, 60, 62, 91, 93, 123, 125);

	function isTokenChar($c){
		return $this->isNumChar($c) || $this->isAlpChar($c) || $c == '_' || $c == '-';
	}
	
	function isNumChar($c){
		$o = ord($c);
		return $o >= 48 && $o <=57;
	}
	
	function isAlpChar($c){
		$o = ord($c);
		return ($o >=65 && $o <=90) || ($o >=97 && $o <=122);
	}
	
	function isBracketChar($c){
		$o = ord($c);
		return in_array($o, $this->brackets);
	}
	
	function isQuoteChar($c){
		$o = ord($c);
		return $o == 34 || $o == 39;
	}
	
	function isSpace($c){
		$o = ord($c);
		return $o == 32 || $o == 9 || $o == 13 || $o == 10;
	}
	
	function isSpecialChar($c){
		return !$this->isNumChar($c) && !$this->isAlpChar($c) && 
			!$this->isBracketChar($c) && !$this->isQuoteChar($c) &&
			!$this->isSpace($c) &&	!in_array($c, array(',','=','_','-'));
	}
}
